package tech.bmatch.phone_recognize;


import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import tech.bmatch.phone_recognize.model.PhoneInfo;
import tech.bmatch.phone_recognize.service.PhoneRecognizeService;
import tech.bmatch.phone_recognize.service.impl.PhoneRecognizeServiceImpl;

import java.util.Scanner;

/**
 * @author: Awake
 * @date: 2018-11-10 11:53
 **/
public class Application {
    /**
     * logger
     */
    private static final Logger logger = LoggerFactory.getLogger(Application.class);

    /**
     * 静态服务
     */
    private static PhoneRecognizeService phoneRecognizeService = new PhoneRecognizeServiceImpl();

    public static void main(String[] args) {

        logger.info("start application");

        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入号码：");
        while (scanner.hasNext()) {
            PhoneInfo phoneInfo = phoneRecognizeService.onCall(scanner.next());
            System.out.println("省份:" + phoneInfo.getProvince()
                    + "  城市:" + phoneInfo.getCity()
                    + "  运营商:" + phoneInfo.getOperator()
                    + "  邮编:" + phoneInfo.getPostCode());
        }
    }
}
